//
//  CNSearchSelectView.m
//  BeeQuick_19
//
//  Created by kimi on 16/9/23.
//  Copyright © 2016年 CN Team. All rights reserved.
//




#import "CNSearchSelectView.h"

@interface CNSearchSelectView ()
@property (weak, nonatomic) IBOutlet UIButton *synthesizeSortBtn;

@property (weak, nonatomic) IBOutlet UIButton *priceSortBtn;

@property (weak, nonatomic) IBOutlet UIButton *salesSortBtn;

@end

@implementation CNSearchSelectView

+ (instancetype)searchSelectNavView{
    return [[NSBundle mainBundle] loadNibNamed:@"CNSearchSelectView" owner:nil options:nil].lastObject;
}

//综合排序
- (IBAction)synthesizeSortClick:(UIButton *)sender {
    
    sender.selected = true;
    self.priceSortBtn.selected = false;
    self.salesSortBtn.selected = false;
    
    if (self.sortBlock) {
        self.sortBlock(kSynthesizeSort);
    }
}

- (IBAction)priceSortClick:(UIButton *)sender {
    
    sender.selected = true;
    self.synthesizeSortBtn.selected = false;
    self.salesSortBtn.selected = false;
    
    if (self.sortBlock) {
        self.sortBlock(kPriceSort);
    }
}
- (IBAction)salesSortClick:(UIButton *)sender {
    sender.selected = true;
    self.priceSortBtn.selected = false;
    self.synthesizeSortBtn.selected = false;
    if (self.sortBlock) {
        self.sortBlock(kSalesSort);
    }
}


- (void)changeViewSelectWithType:(SortType)type
{
    switch (type) {
        case kSynthesizeSort:
            self.synthesizeSortBtn.selected = true;
            self.priceSortBtn.selected = false;
            self.salesSortBtn.selected = false;
            break;
        case kPriceSort:
            self.priceSortBtn.selected = true;
            self.synthesizeSortBtn.selected = false;
            self.salesSortBtn.selected = false;
            break;
        case kSalesSort:
            self.salesSortBtn.selected = true;
            self.priceSortBtn.selected = false;
            self.synthesizeSortBtn.selected = false;
            break;
        default:
            break;
    }
}


@end
